import {IRedisService} from "./IRedisService.interface";
import {Injectable} from "@nestjs/common";
import {InjectRedis} from "@nestjs-modules/ioredis";
import Redis from 'ioredis';

@Injectable()
export class RedisService implements IRedisService{

    constructor(
        @InjectRedis() private readonly client: Redis
    ) {
    }

    async getValue<T>(key: string): Promise<T> {
        if (!key || key === '*') return null;
        const res = await this.client.get(key);
        return JSON.parse(res);
    }

    setValue<T>(key: string, value: T): void {
    }

    setValueAndExpired<T>(key: string, value: T, expired: number): void {
    }




}